home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: in2.uu.net!pgh!cliff
- From: cliff@pgh.nauticom.net (Cliff Frescura K3LL)
- Subject: Re: malloc failure
- Message-ID: <Dn5ovo.F9K@pgh.nauticom.net>
- Date: Thu, 22 Feb 1996 02:42:59 GMT
- References: <4a9c7v$7jb@gsusgi1.gsu.edu> <4aicjc$js@news.cerf.net>
- Organization: Nauticom - Internet Access Provider
- X-Newsreader: TIN [version 1.2 PL2]
-
- Mike Lee (mikey@banzai.ontek.com) wrote:
- : In comp.lang.c, matmrlx@gsusgi1.gsu.edu (Michael R. Lauer) writes:
- : | Every time I call malloc I test the return for NULL, but when it does
- : | fail, what can I do--assuming I really need the space--to recover?
- : | Exiting the program seems to be an inadequate solution.
-
- : An unusual solution is to just wait patiently for more memory to
- : become available. On most unix machines, virtual memory can be
- : added to a running system. On PC's and Mac's, you can usually free
- : up some memory by exiting other programs or turning off some
- : operating system features. Once some memory is made available,
- : by whatever means, your program can then continue without incident.
-
- : mikey
-
- Or, if you are *really* desperate, code up your own malloc which
- will use free disk space instead of memory. Maybe later it could
- be moved to memory when it becomes available. (I did say desperate!)
-
- -Cliff
- --
-
- +----------------------------------------------------------------------+
- |cliff@nauticom.net "All bags are subject to search." |
- | k3ll@nauticom.net "Adapt, Migrate, or Die." |
-